package main

import "fmt"

func main() {
	var m map[int]string //int是值的类型,string是键的类型
	m = map[int]string{
		1: "hello",
		2: "world",
	}
	delete(m, 1)               //删除对应键的值
	m1 := make(map[int]string) //快速创建
	m1[1] = "ok"
	fmt.Println(m, "\n", m1)

	// 迭代操作
	sm := make([]map[int]string, 5)
	for i := range sm {
		sm[i] = make(map[int]string, 1)
		sm[i][1] = "ok"
		fmt.Println(sm[i])
	}
	fmt.Println(sm)

}
